package o;

import com.huawei.hwid.core.constants.HwAccountConstants;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class cfp<T> {
    private String ˋ;

    public cfp(String str) {
        this.ˋ = str;
    }

    public boolean ˎ(T t) {
        Closeable fileOutputStream;
        Closeable objectOutputStream;
        boolean z;
        Throwable th;
        try {
            fileOutputStream = new FileOutputStream(this.ˋ);
            try {
                objectOutputStream = new ObjectOutputStream(fileOutputStream);
                try {
                    objectOutputStream.writeObject(t);
                    z = true;
                } catch (FileNotFoundException e) {
                    z = false;
                    try {
                        Logger.e("SerializedObject", "write file FileNotFoundException, " + ॱ(t));
                        dnw.ˎ(objectOutputStream);
                        dnw.ˎ(fileOutputStream);
                        return z;
                    } catch (Throwable th2) {
                        th = th2;
                        dnw.ˎ(objectOutputStream);
                        dnw.ˎ(fileOutputStream);
                        throw th;
                    }
                } catch (IllegalArgumentException e2) {
                    z = false;
                    Logger.e("SerializedObject", "write file IllegalArgumentException, " + ॱ(t));
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                    return z;
                } catch (IOException e3) {
                    z = false;
                    Logger.e("SerializedObject", "write file IOException, " + ॱ(t));
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                    return z;
                } catch (Exception e4) {
                    z = false;
                    Logger.e("SerializedObject", "write file Exception, " + ॱ(t));
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                    return z;
                }
                try {
                    if (Logger.ˎ() && t != null) {
                        Logger.ˏ("SerializedObject", "write type " + t.getClass() + " to disk sucessfully.");
                    }
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                } catch (FileNotFoundException e5) {
                    Logger.e("SerializedObject", "write file FileNotFoundException, " + ॱ(t));
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                    return z;
                } catch (IllegalArgumentException e6) {
                    Logger.e("SerializedObject", "write file IllegalArgumentException, " + ॱ(t));
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                    return z;
                } catch (IOException e7) {
                    Logger.e("SerializedObject", "write file IOException, " + ॱ(t));
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                    return z;
                } catch (Exception e8) {
                    Logger.e("SerializedObject", "write file Exception, " + ॱ(t));
                    dnw.ˎ(objectOutputStream);
                    dnw.ˎ(fileOutputStream);
                    return z;
                }
            } catch (FileNotFoundException e9) {
                objectOutputStream = null;
                z = false;
                Logger.e("SerializedObject", "write file FileNotFoundException, " + ॱ(t));
                dnw.ˎ(objectOutputStream);
                dnw.ˎ(fileOutputStream);
                return z;
            } catch (IllegalArgumentException e10) {
                objectOutputStream = null;
                z = false;
                Logger.e("SerializedObject", "write file IllegalArgumentException, " + ॱ(t));
                dnw.ˎ(objectOutputStream);
                dnw.ˎ(fileOutputStream);
                return z;
            } catch (IOException e11) {
                objectOutputStream = null;
                z = false;
                Logger.e("SerializedObject", "write file IOException, " + ॱ(t));
                dnw.ˎ(objectOutputStream);
                dnw.ˎ(fileOutputStream);
                return z;
            } catch (Exception e12) {
                objectOutputStream = null;
                z = false;
                Logger.e("SerializedObject", "write file Exception, " + ॱ(t));
                dnw.ˎ(objectOutputStream);
                dnw.ˎ(fileOutputStream);
                return z;
            } catch (Throwable th3) {
                Throwable th4 = th3;
                objectOutputStream = null;
                th = th4;
                dnw.ˎ(objectOutputStream);
                dnw.ˎ(fileOutputStream);
                throw th;
            }
        } catch (FileNotFoundException e13) {
            fileOutputStream = null;
            objectOutputStream = null;
            z = false;
            Logger.e("SerializedObject", "write file FileNotFoundException, " + ॱ(t));
            dnw.ˎ(objectOutputStream);
            dnw.ˎ(fileOutputStream);
            return z;
        } catch (IllegalArgumentException e14) {
            fileOutputStream = null;
            objectOutputStream = null;
            z = false;
            Logger.e("SerializedObject", "write file IllegalArgumentException, " + ॱ(t));
            dnw.ˎ(objectOutputStream);
            dnw.ˎ(fileOutputStream);
            return z;
        } catch (IOException e15) {
            fileOutputStream = null;
            objectOutputStream = null;
            z = false;
            Logger.e("SerializedObject", "write file IOException, " + ॱ(t));
            dnw.ˎ(objectOutputStream);
            dnw.ˎ(fileOutputStream);
            return z;
        } catch (Exception e16) {
            fileOutputStream = null;
            objectOutputStream = null;
            z = false;
            Logger.e("SerializedObject", "write file Exception, " + ॱ(t));
            dnw.ˎ(objectOutputStream);
            dnw.ˎ(fileOutputStream);
            return z;
        } catch (Throwable th5) {
            objectOutputStream = null;
            th = th5;
            fileOutputStream = null;
            dnw.ˎ(objectOutputStream);
            dnw.ˎ(fileOutputStream);
            throw th;
        }
        return z;
    }

    public T ˎ() {
        Closeable objectInputStream;
        Throwable th;
        Closeable closeable;
        ClassNotFoundException classNotFoundException;
        IOException iOException;
        IllegalArgumentException illegalArgumentException;
        Throwable th2;
        Closeable closeable2;
        T t = null;
        Closeable fileInputStream;
        try {
            fileInputStream = new FileInputStream(this.ˋ);
            try {
                objectInputStream = new ObjectInputStream(fileInputStream);
                try {
                    t = objectInputStream.readObject();
                    if (Logger.ˎ() && t != null) {
                        Logger.ˏ("SerializedObject", "read type " + t.getClass() + " from disk sucessfully.");
                    }
                    dnw.ˎ(objectInputStream);
                    dnw.ˎ(fileInputStream);
                } catch (FileNotFoundException e) {
                    try {
                        Logger.e("SerializedObject", "read file FileNotFoundException");
                        dnw.ˎ(objectInputStream);
                        dnw.ˎ(fileInputStream);
                        return t;
                    } catch (Throwable th3) {
                        th = th3;
                        closeable = objectInputStream;
                        objectInputStream = fileInputStream;
                        dnw.ˎ(closeable);
                        dnw.ˎ(objectInputStream);
                        throw th;
                    }
                } catch (ClassNotFoundException e2) {
                    ClassNotFoundException classNotFoundException2 = e2;
                    closeable = objectInputStream;
                    objectInputStream = fileInputStream;
                    classNotFoundException = classNotFoundException2;
                    try {
                        Logger.e("SerializedObject", "read file ClassNotFoundException" + classNotFoundException.getMessage());
                        dnw.ˎ(closeable);
                        dnw.ˎ(objectInputStream);
                        return t;
                    } catch (Throwable th4) {
                        th = th4;
                        dnw.ˎ(closeable);
                        dnw.ˎ(objectInputStream);
                        throw th;
                    }
                } catch (IOException e3) {
                    IOException iOException2 = e3;
                    closeable = objectInputStream;
                    objectInputStream = fileInputStream;
                    iOException = iOException2;
                    Logger.e("SerializedObject", "read file IOException" + iOException.getMessage());
                    dnw.ˎ(closeable);
                    dnw.ˎ(objectInputStream);
                    return t;
                } catch (IllegalArgumentException e4) {
                    IllegalArgumentException illegalArgumentException2 = e4;
                    closeable = objectInputStream;
                    objectInputStream = fileInputStream;
                    illegalArgumentException = illegalArgumentException2;
                    Logger.e("SerializedObject", "read file IllegalArgumentException" + illegalArgumentException.getMessage());
                    dnw.ˎ(closeable);
                    dnw.ˎ(objectInputStream);
                    return t;
                } catch (Throwable e5) {
                    Throwable th5 = e5;
                    closeable = objectInputStream;
                    objectInputStream = fileInputStream;
                    th2 = th5;
                    Logger.ˋ("SerializedObject", "read file Exception", th2);
                    dnw.ˎ(closeable);
                    dnw.ˎ(objectInputStream);
                    return t;
                }
            } catch (FileNotFoundException e6) {
                objectInputStream = null;
                Logger.e("SerializedObject", "read file FileNotFoundException");
                dnw.ˎ(objectInputStream);
                dnw.ˎ(fileInputStream);
                return t;
            } catch (ClassNotFoundException e7) {
                closeable = null;
                closeable2 = fileInputStream;
                classNotFoundException = e7;
                objectInputStream = closeable2;
                Logger.e("SerializedObject", "read file ClassNotFoundException" + classNotFoundException.getMessage());
                dnw.ˎ(closeable);
                dnw.ˎ(objectInputStream);
                return t;
            } catch (IOException e8) {
                closeable = null;
                closeable2 = fileInputStream;
                iOException = e8;
                objectInputStream = closeable2;
                Logger.e("SerializedObject", "read file IOException" + iOException.getMessage());
                dnw.ˎ(closeable);
                dnw.ˎ(objectInputStream);
                return t;
            } catch (IllegalArgumentException e9) {
                closeable = null;
                closeable2 = fileInputStream;
                illegalArgumentException = e9;
                objectInputStream = closeable2;
                Logger.e("SerializedObject", "read file IllegalArgumentException" + illegalArgumentException.getMessage());
                dnw.ˎ(closeable);
                dnw.ˎ(objectInputStream);
                return t;
            } catch (Throwable e10) {
                closeable = null;
                closeable2 = fileInputStream;
                th2 = e10;
                objectInputStream = closeable2;
                Logger.ˋ("SerializedObject", "read file Exception", th2);
                dnw.ˎ(closeable);
                dnw.ˎ(objectInputStream);
                return t;
            } catch (Throwable e102) {
                closeable = null;
                th = e102;
                objectInputStream = fileInputStream;
                dnw.ˎ(closeable);
                dnw.ˎ(objectInputStream);
                throw th;
            }
        } catch (FileNotFoundException e11) {
            fileInputStream = null;
            objectInputStream = null;
            Logger.e("SerializedObject", "read file FileNotFoundException");
            dnw.ˎ(objectInputStream);
            dnw.ˎ(fileInputStream);
            return t;
        } catch (ClassNotFoundException e12) {
            classNotFoundException = e12;
            objectInputStream = null;
            closeable = null;
            Logger.e("SerializedObject", "read file ClassNotFoundException" + classNotFoundException.getMessage());
            dnw.ˎ(closeable);
            dnw.ˎ(objectInputStream);
            return t;
        } catch (IOException e13) {
            iOException = e13;
            objectInputStream = null;
            closeable = null;
            Logger.e("SerializedObject", "read file IOException" + iOException.getMessage());
            dnw.ˎ(closeable);
            dnw.ˎ(objectInputStream);
            return t;
        } catch (IllegalArgumentException e14) {
            illegalArgumentException = e14;
            objectInputStream = null;
            closeable = null;
            Logger.e("SerializedObject", "read file IllegalArgumentException" + illegalArgumentException.getMessage());
            dnw.ˎ(closeable);
            dnw.ˎ(objectInputStream);
            return t;
        } catch (Exception e15) {
            th2 = e15;
            objectInputStream = null;
            closeable = null;
            Logger.ˋ("SerializedObject", "read file Exception", th2);
            dnw.ˎ(closeable);
            dnw.ˎ(objectInputStream);
            return t;
        } catch (Throwable th22) {
            objectInputStream = null;
            closeable = null;
            th = th22;
            dnw.ˎ(closeable);
            dnw.ˎ(objectInputStream);
            throw th;
        }
        return t;
    }

    private String ॱ(Object obj) {
        return obj != null ? obj.getClass().toString() : HwAccountConstants.NULL;
    }

    public long ˋ() {
        return new File(this.ˋ).lastModified();
    }
}
